package cz.hanis.android.geography.activities;

import com.actionbarsherlock.app.SherlockActivity;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuItem;

import cz.hanis.android.geography.AboutDialog;
import cz.hanis.android.geography.R;
import android.content.Intent;
import android.os.Bundle;

import android.util.Log;
import android.view.View;
import android.widget.ImageButton;

public class WelcomeActivity extends SherlockActivity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.welcome);	
		ImageButton btTests = (ImageButton) findViewById(R.id.bt_welcome_test);
		ImageButton btLearn = (ImageButton) findViewById(R.id.bt_welcome_learning);		
		btTests.setOnClickListener(new View.OnClickListener() {			
			@Override
			public void onClick(View v) {
				Intent intent = new Intent(WelcomeActivity.this, TestChooserActivity.class);
				startActivity(intent);
			}
		});


		
		btLearn.setOnClickListener(new View.OnClickListener() {			
			@Override
			public void onClick(View v) {
				Intent intent = new Intent(WelcomeActivity.this, CountryListActivity.class);
				startActivity(intent);
			}
		});

	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		getSupportMenuInflater().inflate(R.menu.welcome_menu, menu);
		return super.onCreateOptionsMenu(menu);
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		switch (item.getItemId()) {		
		case R.id.mi_welcome_menu_about:
			AboutDialog about = new AboutDialog(this);
			about.setTitle(getResources().getString(R.string.menu_welcome_about));
			about.show();
			return true;
		case R.id.mi_welcome_menu_highscore:
			Intent intent = new Intent(WelcomeActivity.this, HighScoreTableActivity.class);
			intent.putExtra(HighScoreTableActivity.FROM_ACTIVITY, HighScoreTableActivity.FROM_WELCOME_ACTIVITY);
			startActivity(intent);
			return true;
		default:
            return super.onOptionsItemSelected(item);
		}
	}	
	
	//HTC id 11FCBA5AAA2B27A07ECEC51C126E2AC6,

}
